package fr.upmc.contact.model;

import android.net.Uri;
import android.os.Parcel;
import android.os.Parcelable;

/**
 * Modelisation of a Android Contact Phone
 * 
 * @author hong
 * 
 */
public class Contact implements Parcelable {
	/**
	 * Firstname
	 */
	private String firstname;
	/**
	 * Nickname
	 */
	private String name;
	/**
	 * Photo Uri access
	 */
	private Uri photo;

	/**
	 * @return The photo uri
	 */
	public Uri getPhoto() {
		return photo;
	}

	/**
	 * 
	 * @param photo
	 *            set the photo uri
	 */
	public void setPhoto(Uri photo) {
		this.photo = photo;
	}

	/**
	 * Default Constructor
	 */
	public Contact() {
	}

	/**
	 * 
	 * @return The firstname of contact
	 */
	public String getFirstname() {
		return firstname;
	}

	/**
	 * @param firstname
	 *            The firstname of contact
	 */
	public void setFirstname(String firstname) {
		this.firstname = firstname;
	}

	/**
	 * 
	 * @return The nickname
	 */
	public String getName() {
		return name;
	}

	/**
	 * 
	 * @param name
	 *            The nickname
	 */
	public void setName(String name) {
		this.name = name;
	}

	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	public void writeToParcel(Parcel dest, int flag) {
		dest.writeString(firstname);
		dest.writeString(name);
		dest.writeString(photo.toString());
	}

	protected Contact(Parcel in) {
		/* When charging element from Parcel element : Restoration */
		firstname = in.readString();
		name = in.readString();
		photo = Uri.parse(in.readString());
	}

}
